package com.bigfire.dtm.domain.ability.aggregate;

import java.util.ArrayList;

public class TeamCompetenceModel extends ArrayList<ProgrammerCompetenceModel> implements ICompetenceModel {
    //权重
    public static final double weightDoneEfficiency = 0.1;
    public static final double weightDoneRate = 0.15;
    public static final double weightInRate = 0.05;
    public static final double weightDelayRate = 0.05;
    public static final double weightQuality = 0.1;
    public static final double weightFeeRate = 0.1;
    public static final double weightBuzRate = 0.05;
    public static final double weightTechEfficiency = 0.1;
    public static final double weightCapability = 0.05;
    public static final double weightAvailable = 0.1;
    public static final double weightPerformance = 0.05;
    public static final double weightTechAssets = 0.05;

    public static void main(String[] args) {
        //team a程序员1的胜任力
        ProgrammerCompetenceModel programmerCompetenceModel1 = new ProgrammerCompetenceModel(6, 3, 10, 3, 2, 2, 1, 20000, 7, 1, 0.8, 5, 1, 1);
        //team a程序员2的胜任力
        ProgrammerCompetenceModel programmerCompetenceModel2 = new ProgrammerCompetenceModel(8, 3.5, 10, 2, 1, 4, 2, 25000, 7, 1.25, 1.2, 2, 0, 2);
        //team a程序员3的胜任力
        ProgrammerCompetenceModel programmerCompetenceModel3 = new ProgrammerCompetenceModel(4, 2, 6, 1, 1, 1, 1, 15000, 5, 0.8, 0.6, 0, 0, 0);

        //team a的胜任力
        TeamCompetenceModel teamaCompetenceModel = new TeamCompetenceModel();
        teamaCompetenceModel.add(programmerCompetenceModel1);
        teamaCompetenceModel.add(programmerCompetenceModel2);
        teamaCompetenceModel.add(programmerCompetenceModel3);

        System.out.println("--------------team a---------------" );
        System.out.println("team a：DoneEfficiency" + teamaCompetenceModel.getDoneEfficiencyValue() + ";");
        System.out.println("team a：DoneRate" + teamaCompetenceModel.getDoneRateValue() + ";");
        System.out.println("team a：InRate" + teamaCompetenceModel.getInRateValue() + ";");
        System.out.println("team a：DelayRate" + teamaCompetenceModel.getDelayRateValue() + ";");
        System.out.println("team a：Quality" + teamaCompetenceModel.getQualityValue() + ";");
        System.out.println("team a：FeeRate" + teamaCompetenceModel.getFeeRateValue() + ";");
        System.out.println("team a：BuzRate" + teamaCompetenceModel.getBuzRateValue() + ";");
        System.out.println("team a：TechEfficiency" + teamaCompetenceModel.getTechEfficiencyValue() + ";");
        System.out.println("team a：Capability" + teamaCompetenceModel.getCapabilityValue() + ";");

        //team b程序员4的胜任力
        ProgrammerCompetenceModel programmerCompetenceModel4 = new ProgrammerCompetenceModel(6, 4, 8, 3, 2.5, 2, 1, 20000, 7, 1, 0.8, 1, 1, 1);
        //team b程序员5的胜任力
        ProgrammerCompetenceModel programmerCompetenceModel5 = new ProgrammerCompetenceModel(7, 3.5, 9, 2, 0.5, 4, 2, 25000, 7, 1.25, 1.2, 1, 1, 1);
        //team b程序员6的胜任力
        ProgrammerCompetenceModel programmerCompetenceModel6 = new ProgrammerCompetenceModel(4, 2, 6, 1, 1.5, 1, 1, 15000, 5, 0.8, 0.6, 0, 0, 0);
        //team b程序员7的胜任力
        ProgrammerCompetenceModel programmerCompetenceModel7 = new ProgrammerCompetenceModel(5, 3, 7, 2, 1.5, 2, 1, 17000, 6, 0.9, 0.7, 0, 0, 0);

        //team a的胜任力
        TeamCompetenceModel teambCompetenceModel = new TeamCompetenceModel();
        teambCompetenceModel.add(programmerCompetenceModel4);
        teambCompetenceModel.add(programmerCompetenceModel5);
        teambCompetenceModel.add(programmerCompetenceModel6);
        teambCompetenceModel.add(programmerCompetenceModel7);

        System.out.println("--------------team b---------------" );
        System.out.println("team b：DoneEfficiency" + teambCompetenceModel.getDoneEfficiencyValue() + ";");
        System.out.println("team b：DoneRate" + teambCompetenceModel.getDoneRateValue() + ";");
        System.out.println("team b：InRate" + teambCompetenceModel.getInRateValue() + ";");
        System.out.println("team b：DelayRate" + teambCompetenceModel.getDelayRateValue() + ";");
        System.out.println("team b：Quality" + teambCompetenceModel.getQualityValue() + ";");
        System.out.println("team b：FeeRate" + teambCompetenceModel.getFeeRateValue() + ";");
        System.out.println("team b：BuzRate" + teambCompetenceModel.getBuzRateValue() + ";");
        System.out.println("team b：TechEfficiency" + teambCompetenceModel.getTechEfficiencyValue() + ";");
        System.out.println("team b：Capability" + teambCompetenceModel.getCapabilityValue() + ";");

    }

    @Override
    public double getCompetenceOutputValue() {
        return getDoneEfficiencyValue() * weightDoneEfficiency + getDoneRateValue() * weightDoneRate + getInRateValue() * weightInRate + getDelayRateValue() * weightDelayRate + getQualityValue() * weightQuality;
    }

    @Override
    public double getCompetenceFeeRateValue() {
        return getFeeRateValue() * weightFeeRate;
    }

    public double getCompetenceWishValue() {
        return getBuzRateValue() * weightBuzRate + getTechEfficiencyValue() * weightTechEfficiency;
    }

    public double getCompetenceCapabilityValue() {
        return getCapabilityValue() * weightCapability;
    }

    public double getCompetenceGrowValue() {
        return 0;
    }

    @Override
    public double getDoneEfficiencyValue() {
        double d = 0;
        for (ProgrammerCompetenceModel proCom : this) {
            d += proCom.getDoneEfficiencyValue();
        }

        return d / this.size();
    }

    @Override
    public double getDoneRateValue() {
        double d = 0;
        for (ProgrammerCompetenceModel proCom : this) {
            d += proCom.getDoneRateValue();
        }

        return d / this.size();
    }

    @Override
    public double getInRateValue() {
        double d = 0;
        for (ProgrammerCompetenceModel proCom : this) {
            d += proCom.getInRateValue();
        }

        return d / this.size();

    }

    @Override
    public double getDelayRateValue() {
        double d = 0;
        for (ProgrammerCompetenceModel proCom : this) {
            d += proCom.getDelayRateValue();
        }

        return d / this.size();

    }

    @Override
    public double getQualityValue() {
        double d = 0;
        for (ProgrammerCompetenceModel proCom : this) {
            d += proCom.getQualityValue();
        }

        return d / this.size();

    }

    @Override
    public double getFeeRateValue() {
        double d = 0;
        for (ProgrammerCompetenceModel proCom : this) {
            d += proCom.getFeeRateValue();
        }

        return d / this.size();

    }

    @Override
    public double getBuzRateValue() {
        double d = 0;
        for (ProgrammerCompetenceModel proCom : this) {
            d += proCom.getBuzRateValue();
        }

        return d / this.size();

    }

    @Override
    public double getTechEfficiencyValue() {
        double d = 0;
        for (ProgrammerCompetenceModel proCom : this) {
            d += proCom.getTechEfficiencyValue();
        }

        return d / this.size();

    }

    @Override
    public double getCapabilityValue() {
        double d = 0;
        for (ProgrammerCompetenceModel proCom : this) {
            d += proCom.getCapabilityValue();
        }

        return d / this.size();

    }
}
